<template>
  <div class="q-pa-md">
    <t-layout
      view="hHh Lpr lff"
      container
      style="height: 300px"
      class="shadow-2 rounded-borders"
    >
      <t-header
        elevated
        :class="$q.dark.isActive ? 'bg-secondary' : 'bg-black'"
      >
        <t-toolbar>
          <t-btn flat @click="drawer = !drawer" round dense icon="menu" />
          <t-toolbar-title>Header</t-toolbar-title>
        </t-toolbar>
      </t-header>

      <t-drawer
        v-model="drawer"
        show-if-above
        :width="200"
        :breakpoint="500"
        bordered
        :class="$q.dark.isActive ? 'bg-grey-9' : 'bg-grey-3'"
      >
        <t-scroll-area class="fit">
          <t-list>
            <template v-for="(menuItem, index) in menuList" :key="index">
              <t-item clickable :active="menuItem.label === 'Outbox'" v-ripple>
                <t-item-section avatar>
                  <t-icon :name="menuItem.icon" />
                </t-item-section>
                <t-item-section>
                  {{ menuItem.label }}
                </t-item-section>
              </t-item>
              <t-separator :key="'sep' + index" v-if="menuItem.separator" />
            </template>
          </t-list>
        </t-scroll-area>
      </t-drawer>

      <t-page-container>
        <t-page padding>
          <p v-for="n in 15" :key="n">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit nihil
            praesentium molestias a adipisci, dolore vitae odit, quidem
            consequatur optio voluptates asperiores pariatur eos numquam rerum
            delectus commodi perferendis voluptate?
          </p>
        </t-page>
      </t-page-container>
    </t-layout>
  </div>
</template>

<script>
  import { ref } from 'vue';

  const menuList = [
    {
      icon: 'inbox',
      label: 'Inbox',
      separator: true,
    },
    {
      icon: 'send',
      label: 'Outbox',
      separator: false,
    },
    {
      icon: 'delete',
      label: 'Trash',
      separator: false,
    },
    {
      icon: 'error',
      label: 'Spam',
      separator: true,
    },
    {
      icon: 'settings',
      label: 'Settings',
      separator: false,
    },
    {
      icon: 'feedback',
      label: 'Send Feedback',
      separator: false,
    },
    {
      icon: 'help',
      iconColor: 'primary',
      label: 'Help',
      separator: false,
    },
  ];

  export default {
    setup() {
      return {
        drawer: ref(false),
        menuList,
      };
    },
  };
</script>
